<script setup>
import { useRouter } from 'vue-router'
import LoginForm from '../../components/LoginForm.vue'

const router = useRouter()

const handleLoginSuccess = () => {
  router.push('/')
}

const goToRegister = () => {
  router.push('/register')
}
</script>

<template>
  <div class="login-container">
    <div class="login-box">
      <div class="login-header">
        <img src="https://img.icons8.com/color/96/000000/hospital-2.png" alt="医院图标" />
        <h1>医院科室排班管理系统</h1>
        <p>排班员登录</p>
      </div>
      
      <LoginForm @login-success="handleLoginSuccess" />
      
      <div class="login-footer">
        <p>没有账号？<el-button type="text" @click="goToRegister">立即注册</el-button></p>
        <p>© 2023 医院科室排班管理系统</p>
      </div>
    </div>
  </div>
</template>

<style scoped>
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  background-image: url('https://images.unsplash.com/photo-1538108149393-fbbd81895907?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2000&q=80');
  background-size: cover;
  background-position: center;
}

.login-box {
  width: 400px;
  padding: 40px;
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.login-header img {
  width: 80px;
  height: 80px;
}

.login-header h1 {
  font-size: 24px;
  color: #409EFF;
  margin: 15px 0 10px;
}

.login-header p {
  font-size: 16px;
  color: #606266;
  margin: 0;
}

.login-footer {
  text-align: center;
  color: #909399;
  font-size: 12px;
}

.login-footer p {
  margin: 5px 0;
}
</style> 